<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * View file: index
 *
 * @author luubk
 * @since 12-06-2012 - 01:13:56
 */
?>
<div id="result"></div>
<?php if (isset($del_noti)): ?>
    <h4 class="alert_success"><?php echo $del_noti ?></h4>
<?php endif; ?>
    
<?php if (isset($cate_select_box)): ?>
    <article class="module width_full" style="border: 0">
        <form>
            <select name="cate" onchange="$(this).parent().submit()">
                <option value=""> -- Tất cả thể loại --</option>
                <?php echo $cate_select_box ?>
            </select>
            <select name="status" onchange="$(this).parent().submit()">
                <?php $status = $this->input->get('status'); ?>
                <option value="-1" <?php echo ($status === '' OR $status === '-1') ? 'selected="selected"' : '' ?>> -- Tất cả trạng thái --</option>
                <option value="0" <?php echo ($status === '0') ? 'selected="selected"' : '' ?>>Vô hiệu hóa</option>
                <option value="1" <?php echo ($status === '1') ? 'selected="selected"' : '' ?>>Kích hoạt</option>                
            </select>
        </form>
    </article>
<?php endif; ?>
<article class="module width_full">
    <header>
        <h3><?php echo $title ?></h3>
    </header>
    <table class="tablesorter" cellspacing="0"> 
        <thead> 
            <tr>
                <th>#</th>
                <th>HOT</th>
                <th>Album</th> 
                <th>Tên album</th> 
                <th>Xem</th>
                <th>Tải</th>
                <th>Thể loại</th>
                <th>Cập nhật</th>
                <th>Khởi tạo</th>
                <th>Trạng thái</th> 
                <th>Xử lý</th> 
            </tr> 
        </thead>
        <tbody class="sortable">
            <?php $i = $this->input->get('offset') ? $this->input->get('offset') : 0; ?>
            <?php if ($items): ?>                
                <?php foreach ($items as $item): ?>
                    <tr id="<?php echo ($item['album_rank'] == 0) ? '' : $item['album_id'] ?>">                        
                        <td><?php echo++$i ?></td>
                        <td>
                            <?php $hot_mess = ($item['album_rank'] == 0) ? 'Đặt là album HOT?' : 'Xóa khỏi album HOT'; ?>
                            <a href="<?php echo site_url('apps/up_hot/' . $item['album_id']) ?>"
                               style="font-size: 1.7em;color:goldenrod;"
                               onclick="return confirm('<?php echo $hot_mess ?>');">
                                   <?php echo ($item['album_rank'] == 0) ? '&star;' : '&starf;'; ?>
                            </a>                            
                        </td>
                        <td>
                            <?php
                            $thumb = ($item['album_thumb'] != '') ? site_url('album/gate/' . urlencode(urlencode(urlencode($item['album_thumb'])))) : base_url() . 'assets/css/_common/images/image.png';
                            ?>
                            <img src="<?php echo $thumb ?>" 
                                 style="max-height:64px;max-width:64px"/>
                        </td> 
                        <td><?php echo $item['album_name'] ?></td> 
                        <td><?php echo $item['album_views'] ?></td> 
                        <td><?php echo $item['album_downloads'] ?></td> 
                        <td><?php echo $item['cate_name'] ?></td>         
                        <td><?php echo $item['album_updated_by'] ?> - <?php echo date('d/m/y H:i', $item['album_updated_at']) ?></td> 
                        <td><?php echo $item['album_created_by'] ?> - <?php echo date('d/m/y H:i', $item['album_created_at']) ?></td> 
                        <td><?php echo status_text($item['album_status']) ?></td> 
                        <td>
                            <?php echo edit_text('album/form/' . $item['album_id']) ?>
                            <?php echo delete_text('album/delete/' . $item['album_id']) ?>
                        </td> 
                    </tr>        
                <?php endforeach; ?>
            <?php else: ?>
                <tr>
                    <td colspan="5">Không có dữ liệu</td>
                </tr>
            <?php endif; ?>
        </tbody> 
    </table>
    <footer>
        <p>            
            <?php echo $paging ?>
        </p>
    </footer>
</article><!-- end of content manager article -->